local request_method = ngx.var.request_method
local args = nil

--1、获取参数的值 获取前端提交参数
if "GET" == request_method then
    args = ngx.req.get_uri_args()
elseif "POST" == request_method then
    ngx.req.read_body()
    args = ngx.req.get_post_args()
end
local operation = args["operation"]
if operation == nil then
   operation ="set"
end
local redisUtil = require "util/redisUtil"
local red = redisUtil.new({host = "10.1.241.17",password="123#@!qwe"})
local res, err = red:exec(
    function(red)
        if operation =="get" then
        return red:get("test.lua.redis")
    else
        red:init_pipeline()
        red:set("test.lua.redis", "set ok")
        red:expire("test.lua.redis", 600)
        return red:commit_pipeline()
    end
    end
)
if not res then  
     ngx.say(operation.."操作没有返回值");
else
    ngx.say(res);
end 